load(
    "//bazel:skia_rules.bzl",
    "generate_cpp_files_for_headers",
    "skia_cc_library",
    "skia_filegroup",
)

package(
    default_applicable_licenses = ["//:license"],
)

licenses(["notice"])

PRIVATE_HEADERS = [
    "SkArenaAlloc.h",
    "SkArenaAllocList.h",
    "SkAutoMalloc.h",
    "SkBase64.h",
    "SkBezierCurves.h",
    "SkBitmaskEnum.h",
    "SkBlockAllocator.h",
    "SkBuffer.h",
    "SkCubics.h",
    "SkEndian.h",
    "SkEnumBitMask.h",
    "SkFixedArray.h",
    "SkFloatBits.h",
    "SkHalf.h",
    "SkLeanWindows.h",
    "SkMSAN.h",
    "SkMathPriv.h",
    "SkNoDestructor.h",
    "SkQuads.h",
    "SkRandom.h",
    "SkRectMemcpy.h",
    "SkSafeMath.h",
    "SkScopeExit.h",
    "SkSharedMutex.h",
    "SkSpinlock.h",
    "SkStringView.h",
    "SkTBlockList.h",
    "SkTDPQueue.h",
    "SkTInternalLList.h",
    "SkTLazy.h",
    "SkTSearch.h",
    "SkTSort.h",
    "SkTime.h",
    "SkUTF.h",
    "SkUtils.h",
    "SkVx.h",
    "SkZip.h",
]

skia_filegroup(
    name = "private_hdrs",
    srcs = PRIVATE_HEADERS,
)

# In a separate file group because these files are exported to sksl.gni:skslc_deps.
skia_filegroup(
    name = "skslc_srcs",
    srcs = [
        "SkArenaAlloc.cpp",
        "SkBlockAllocator.cpp",
        "SkContainers.cpp",
        "SkHalf.cpp",
        "SkMalloc.cpp",
        "SkMathPriv.cpp",
        "SkSafeMath.cpp",
        "SkSemaphore.cpp",
        "SkThreadID.cpp",
        "SkUTF.cpp",
        "SkUtils.cpp",
    ],
)

skia_filegroup(
    name = "srcs",
    srcs = [
        "SkBase64.cpp",
        "SkBezierCurves.cpp",
        "SkBuffer.cpp",
        "SkCubics.cpp",
        "SkDebug.cpp",
        "SkDeque.cpp",
        "SkFloatingPoint.cpp",
        "SkQuads.cpp",
        "SkSharedMutex.cpp",
        "SkSpinlock.cpp",
        "SkTDArray.cpp",
        "SkTSearch.cpp",
        "SkTime.cpp",
        ":skslc_srcs",
    ],
)

skia_cc_library(
    name = "base",
    srcs = [
        ":srcs",
        "//src/ports:base_srcs",
    ],
    hdrs = [
        ":private_hdrs",
        "//include/private/base:private_hdrs",
    ],
    features = ["layering_check"],
    visibility = [
        "//bench:__subpackages__",
        "//modules:__subpackages__",
        "//rust:__subpackages__",
        "//src:__subpackages__",
        "//tests:__subpackages__",
        "//tools:__subpackages__",
    ],
    deps = ["@skia_user_config//:user_config"],
)

generate_cpp_files_for_headers(
    name = "headers_to_compile",
    headers = PRIVATE_HEADERS,
)
